<template>

<div class="box">
  <p v-for="item in news"
:key="item.id">
    <router-link :to="'/news/newscot/' + item.id">
<van-card

  :title="item.title"
  :desc="item.add_time"  
  :thumb="item.img_url"

>
  <div slot="footer">
    
    <span>发布时间:{{item.add_time}}</span>
    <span>点击{{item.click}}次</span>
  
  </div>
  </van-card>
  </router-link>
  </p>

</div>
</template>

<script>

import { Toast } from 'vant';
export default {
  name:'',
  data(){
   return {
    news:[]
   }
  },
  created(){
    this.newlist()
  },
  methods:{
    // newlist(){
    //   this.$http.get("http://localhost:5000/api/getnewslist").then(result => {
    //     if(result.body.status === 0){
    //       this.news = result.body.message
    //       console.log(result)
    //     }
    //   })
    // },
    async newlist(){
       const { 
         body:{status,message}
      } = await this.$http.get('http://localhost:5000/api/getnewslist');
      if(status === 0){
          this.news = message
        }
    }
   
  },
  // filters:{
  //   newclick:() => {
  //     return this.news.replace("x","")
  //   }
  // }
}

//过滤器过滤问题
</script>

<style>

</style>
